Skip to content

[build] Download and bundle Selenium Manager SBOM and NOTICE in each package#17820

Merged
titusfortner merged 1 commit into
SeleniumHQ:trunkfrom
titusfortner:c/selenium-manager-sbom-bundle
Jul 26, 2026
Merged

[build] Download and bundle Selenium Manager SBOM and NOTICE in each package#17820
titusfortner merged 1 commit into
SeleniumHQ:trunkfrom
titusfortner:c/selenium-manager-sbom-bundle

Conversation

@titusfortner

@titusfortner titusfortner commented Jul 24, 2026

Copy link
Copy Markdown
Member

🔗 Related Issues

💥 What does this PR do?

Bundles a CycloneDX SBOM and a third-party NOTICE alongside the Selenium Manager binary in every package that ships it — Python wheel, Java jar, Ruby gem, npm package, NuGet package.

The two files are generated once (cross-platform-complete) by the Selenium Manager release job in #17819 and published to the selenium_manager_artifacts release. This PR downloads them with Bazel http_file — exactly like the binaries — and copies one of each into each package, next to the binary:

Package Location
jar org/openqa/selenium/manager/
wheel selenium/webdriver/common/
gem bin/
npm bin/
nuget package root
  • selenium-manager.cdx.json — a CycloneDX SBOM inventorying the statically-linked Rust crates (name, version, checksum, dependency graph, SPDX license) for vulnerability and license scanning.
  • selenium-manager-THIRD-PARTY-NOTICES.txt — the third-party attribution file reproducing each bundled crate's copyright notice and full license text, which MIT/BSD/ISC/Apache-2.0 require in binary distributions.

🔧 Implementation Notes

  • Downloaded like the binaries: scripts/selenium_manager.py gains print_sbom/print_notice, common/selenium_manager.bzl adds download_sm_sbom/download_sm_notice http_file rules, and common/manager exposes selenium-manager-sbom/-notice aliases.
  • One SBOM and one NOTICE cover every platform (they are cross-platform-complete), so each package gets a single copy in the shared parent of the per-OS binary directories. NuGet lands at the package root because its binaries live under runtimes/<os>/native/.
  • Per-binding wiring: resources (jar), wheel data (py), data (gem), srcs (npm), nuget_pack.files + nuspec <file> (nuget).
  • The Python sdist ships the Rust source (//rust:selenium_manager_srcs) rather than the compiled binary, so both files are excluded there — the same treatment the binaries get.

🤖 AI assistance

  • AI assisted (complete below)
    • Tool(s): Claude Code
    • What was generated: the download wiring and per-binding packaging
    • I reviewed all AI output and can explain the change

💡 Additional Considerations

  • Both files sit next to the binary rather than in the ecosystems' emerging reserved SBOM locations — .dist-info/sboms/ (PEP 770) for wheels and META-INF/sbom/ for jars — because the pinned rules_python py_wheel cannot write into .dist-info/ and the Java move would disturb the manager binary's resource-loading path. Deferred as a follow-up (gated on rules_python PEP 770 support) so a generic scanner can auto-discover the SBOM.
  • [rust] Allow cross-compilation of selenium-manager on all platforms #17586 will need to migrate generation of these files to bazel targets as well since the SBOM/NOTICE are currently produced by running cargo (cargo-cyclonedx + cargo-about) in the release job.

🔄 Types of changes

  • New feature (non-breaking change which adds functionality)

@selenium-ci selenium-ci added C-py Python Bindings C-rb Ruby Bindings C-dotnet .NET Bindings C-java Java Bindings C-nodejs JavaScript Bindings B-build Includes scripting, bazel and CI integrations labels Jul 24, 2026
@titusfortner
titusfortner force-pushed the c/selenium-manager-sbom-bundle branch from 6897e0a to 61c120e Compare July 26, 2026 18:25
@titusfortner
titusfortner marked this pull request as ready for review July 26, 2026 18:27
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Bundle Selenium Manager SBOM and NOTICE into all shipped packages

✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Download Selenium Manager SBOM and THIRD-PARTY notices via Bazel http_file.
• Expose SBOM/NOTICE as common Bazel targets alongside manager binaries.
• Bundle SBOM/NOTICE into Java, Python, Ruby, npm, and NuGet release artifacts.
Diagram

graph TD
  ext{{"selenium_manager_artifacts release"}} --> bzl["common/selenium_manager.bzl"] --> mod["MODULE.bazel"] --> mgr["common/manager aliases"] --> java["Java jar"]
  mgr --> py["Python wheel"]
  mgr --> js["npm package"]
  mgr --> rb["Ruby gem"]
  mgr --> nuget["NuGet package"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Place SBOMs in ecosystem-reserved locations
  • ➕ Aligns with emerging standards (e.g., wheel .dist-info/sboms/, jar META-INF/sbom/)
  • ➕ Makes automated discovery by scanners more consistent
  • ➖ Blocked/awkward with current packaging tooling (e.g., rules_python py_wheel limitations)
  • ➖ May require changing resource lookup/layout expectations for Selenium Manager in jars
2. Generate SBOM/NOTICE per package at build time
  • ➕ Avoids downloading additional artifacts; everything produced in-repo build graph
  • ➕ Could tailor metadata to each package’s exact contents/layout
  • ➖ Complex and slower; requires SBOM generation tooling in each build environment
  • ➖ Higher risk of platform skew vs a single canonical release-generated SBOM
3. Ship SBOM/NOTICE as separate distributable artifacts only
  • ➕ No package size increase for consumers that don’t need compliance metadata
  • ➕ Avoids changing package contents across ecosystems
  • ➖ Compliance and security scanners often expect SBOM/NOTICE bundled with the binary
  • ➖ Harder for downstream redistributors to meet attribution requirements reliably

Recommendation: Current approach (download once from the Selenium Manager artifacts release and bundle next to the binary in every package) is the best near-term tradeoff: it’s consistent across ecosystems, keeps a single canonical SBOM/NOTICE, and minimizes build-time complexity. Consider a follow-up to migrate to ecosystem-reserved SBOM locations once the packaging toolchains make it feasible without layout breakage.

Files changed (10) +119 / -8

Other (10) +119 / -8
MODULE.bazelRegister SBOM/NOTICE artifact repos from selenium_manager extension +2/-0

Register SBOM/NOTICE artifact repos from selenium_manager extension

• Adds 'download_sm_sbom' and 'download_sm_notice' to the repos imported from the 'selenium_manager_artifacts' module extension so they can be referenced by Bazel targets.

MODULE.bazel

BUILD.bazelExpose SBOM and NOTICE as common/manager Bazel aliases +10/-0

Expose SBOM and NOTICE as common/manager Bazel aliases

• Introduces 'selenium-manager-sbom' and 'selenium-manager-notice' aliases pointing at the newly downloaded artifact files, mirroring how platform binaries are exposed.

common/manager/BUILD.bazel

selenium_manager.bzlDownload SBOM/NOTICE artifacts alongside Selenium Manager binaries +20/-7

Download SBOM/NOTICE artifacts alongside Selenium Manager binaries

• Updates the pinned Selenium Manager artifact release (URLs and sha256) and adds 'http_file' rules for the CycloneDX SBOM and third-party NOTICE file.

common/selenium_manager.bzl

BUILD.bazelInclude SBOM/NOTICE in NuGet pack inputs +2/-0

Include SBOM/NOTICE in NuGet pack inputs

• Adds SBOM and NOTICE targets to the 'nuget_pack(files=...)' mapping so they are emitted into the NuGet package output.

dotnet/src/webdriver/BUILD.bazel

Selenium.WebDriver.nuspecAdd SBOM/NOTICE entries to NuGet nuspec +3/-0

Add SBOM/NOTICE entries to NuGet nuspec

• Adds '<file>' entries so the SBOM and third-party notices are included in the final NuGet package (at package root).

dotnet/src/webdriver/Selenium.WebDriver.nuspec

BUILD.bazelBundle SBOM/NOTICE as jar resources for selenium-manager +14/-0

Bundle SBOM/NOTICE as jar resources for selenium-manager

• Copies SBOM/NOTICE into the manager resource directory and includes them in 'java_export(resources=...)' so they ship inside the jar next to the manager binaries.

java/src/org/openqa/selenium/manager/BUILD.bazel

BUILD.bazelShip SBOM/NOTICE in npm package bin/ directory +14/-0

Ship SBOM/NOTICE in npm package bin/ directory

• Adds copy rules for SBOM and NOTICE into 'bin/' and includes them in 'npm_package(srcs=...)' so they publish with the npm distribution.

javascript/selenium-webdriver/BUILD.bazel

BUILD.bazelBundle SBOM/NOTICE into Python wheel data, exclude from sdist +16/-0

Bundle SBOM/NOTICE into Python wheel data, exclude from sdist

• Copies SBOM/NOTICE into 'selenium/webdriver/common/' and includes them in the wheel’s 'py_library(data=...)'. Excludes them from the sdist 'pkg_files', matching the existing treatment for manager binaries.

py/BUILD.bazel

BUILD.bazelBundle SBOM/NOTICE into Ruby gem bin/ contents +14/-0

Bundle SBOM/NOTICE into Ruby gem bin/ contents

• Copies SBOM/NOTICE into 'bin/' and adds them to 'rb_gem_build(data=...)' so the gem ships these artifacts alongside the platform binaries.

rb/BUILD.bazel

selenium_manager.pyTeach generator script to emit SBOM/NOTICE http_file stanzas +24/-1

Teach generator script to emit SBOM/NOTICE http_file stanzas

• Adds 'print_sbom' and 'print_notice' helpers and updates the generated header text. The generator now emits 'download_sm_sbom' and 'download_sm_notice' rules using sha values from 'latest.json'.

scripts/selenium_manager.py

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Unchecked sha JSON keys 🐞 Bug ☼ Reliability
Description
scripts/selenium_manager.py now directly indexes sha_dict["sbom"] and sha_dict["notice"], so
regenerating common/selenium_manager.bzl will crash with a KeyError if the downloaded latest.json is
missing either key. This makes the generator brittle to upstream schema/data issues and fails
without a clear error message about what’s wrong.
Code

scripts/selenium_manager.py[R93-97]

    content = content + print_linux(base_url, sha_dict["linux"])
    content = content + print_macos(base_url, sha_dict["macos"])
    content = content + print_windows(base_url, sha_dict["windows"])
+    content = content + print_sbom(base_url, sha_dict["sbom"])
+    content = content + print_notice(base_url, sha_dict["notice"])
Evidence
The script downloads latest.json from a remote URL and uses dictionary indexing for the newly
added keys sbom and notice without any validation or fallback, which will raise KeyError if
the keys are absent.

scripts/selenium_manager.py[23-29]
scripts/selenium_manager.py[91-98]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`scripts/selenium_manager.py` fetches a remote `latest.json` and then directly indexes new keys (`sbom`, `notice`). If the response is missing these keys (schema drift, partial publish, or other upstream issue), regeneration fails with a raw `KeyError`, which is hard to diagnose.

### Issue Context
The generator already assumes `linux/macos/windows` exist; this PR extends that assumption to `sbom/notice`. Adding explicit validation will make failures actionable and easier to debug.

### Fix Focus Areas
- scripts/selenium_manager.py[23-29]
- scripts/selenium_manager.py[91-98]

### Suggested fix
- Add a required-keys validation after `sha_dict = get_sha_json()`.
- If any keys are missing, `raise RuntimeError(...)` (or `fail(...)` equivalent) with a message listing missing keys and the URL used.
- Optionally validate that the values look like SHA-256 hex strings (length/hex chars) to catch corrupted metadata early.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread scripts/selenium_manager.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the existing Selenium Manager “pinned artifact” download + packaging flow so that every distribution that ships the Selenium Manager binary also ships two compliance artifacts (CycloneDX SBOM + third-party NOTICE) alongside it.

Changes:

  • Extend the Selenium Manager artifact downloader (http_file) wiring to include selenium-manager.cdx.json and selenium-manager-THIRD-PARTY-NOTICES.txt.
  • Add Bazel targets to copy those two artifacts into each binding’s packaged outputs (Java jar, Python wheel, Ruby gem, npm package, NuGet).
  • Wire the new artifacts into the .NET nuspec and Bazel nuget_pack file list.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/selenium_manager.py Generates additional http_file rules for SBOM/NOTICE in the Selenium Manager artifacts extension.
common/selenium_manager.bzl Adds download_sm_sbom/download_sm_notice http_file downloads alongside manager binaries.
MODULE.bazel Exposes the new downloaded repos (download_sm_sbom, download_sm_notice) via use_repo.
common/manager/BUILD.bazel Adds aliases for the SBOM/NOTICE artifacts for consumption by bindings.
py/BUILD.bazel Copies SBOM/NOTICE into the wheel payload and excludes them from the sdist.
rb/BUILD.bazel Copies SBOM/NOTICE into the gem payload under bin/.
javascript/selenium-webdriver/BUILD.bazel Copies SBOM/NOTICE into the npm package payload under bin/ and includes them in npm_package.
java/src/org/openqa/selenium/manager/BUILD.bazel Adds SBOM/NOTICE as jar resources next to the manager binaries.
dotnet/src/webdriver/BUILD.bazel Includes SBOM/NOTICE in nuget_pack.files at NuGet package root.
dotnet/src/webdriver/Selenium.WebDriver.nuspec Adds SBOM/NOTICE <file> entries so they’re included in the NuGet package.
Comments suppressed due to low confidence (1)

common/manager/BUILD.bazel:43

  • Same mismatch as the SBOM: selenium-manager-notice always points at the downloaded release artifact even when //common:pin_browsers=false causes linux/macos binaries to come from //rust:selenium-manager-*. That can bundle a NOTICE file that doesn't correspond to the binary actually being packaged.
alias(
    name = "selenium-manager-notice",
    actual = "@download_sm_notice//file",
)

Comment thread common/manager/BUILD.bazel
@titusfortner
titusfortner merged commit 0d3fcfd into SeleniumHQ:trunk Jul 26, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations C-dotnet .NET Bindings C-java Java Bindings C-nodejs JavaScript Bindings C-py Python Bindings C-rb Ruby Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🚀 Feature]: Include SBOMs with Selenium Manager binaries

3 participants